// =============================================================
// CMIMECallback class
// ---------------------------------------
// Author : Woo-Hyun Kim
// Email : woorung@icu.ac.kr or woorung@nhncorp.com
// Date : Apr. 17, 2008
// =============================================================
#ifndef CMIMECallback_H
#define CMIMECallback_H
//-----------------------------------------------------------------------
#include <iostream>

#include <sys/stat.h>
#include <dirent.h>

#include "soap/baseCFactoryService.h"
#include "soap/baseCFactoryProxy.h"

#include "CMIMECallback.h"
#include "property/CProperty.h"
#include "file/CFile.h"

#include "coord_conf.h"

#ifdef UNIQUE_FILE_NAME
#define CUBE_ENV_UNIQUE_FILE_PREFIX "cube.file.XXXXXX"
#endif

using namespace base;
using namespace std;

struct mime_server_handle {
        char *key;    /* file name */
        FILE *fd;     /* file fd */
};
//-----------------------------------------------------------------------
class CMIMECallback
{
public:
	CMIMECallback();
	virtual ~CMIMECallback();

	static void *read_open(struct soap *soap, void *handle, const char *id, const char *type, const char *description);
	static size_t read(struct soap *soap, void *handle, char *buf, size_t len);
	static void read_close(struct soap *soap, void *handle);

	static void *write_open(struct soap *soap, void *unused_handle, const char *id, const char *type, const char *description, enum soap_mime_encoding encoding);
	static int write(struct soap *soap, void *handle, const char *buf, size_t len);
	static void write_close(struct soap *soap, void *handle);
};
//-----------------------------------------------------------------------
#endif
